/*
 * CameraDevice.h
 *
 *  Created on: 2018年10月3日
 *      Author: zhengboyuan
 */

#ifndef CAMERADEVICE_H_
#define CAMERADEVICE_H_

#include "PersonFlow.h"
#include "TCriticalSection.h"


class CameraDevice
{
public:
    CameraDevice();
    virtual ~CameraDevice();

    virtual bool open(const Camera& camera) =0;
	virtual void close() = 0;
	virtual bool isConnected() = 0;
	virtual bool reconnect() = 0;

	virtual void setSink(PersonFlowSink* sink);

	virtual bool getCount(PersonFlowCount& flowCount);

	virtual std::string getId();

	virtual bool getCamera(Camera& camera);

	virtual void setConnected(bool connected);

	virtual void setCount(const PersonFlowCount& flowCount);

protected:
	void fireDeviceStatus(int connected);

	void fireFlowCount(const PersonFlowCount& flowCount);

protected:
	comn::CriticalSection	m_cs;
	Camera	m_camera;
	PersonFlowCount	m_flowCount;
	PersonFlowSink*	m_sink;

};

#endif /* CAMERADEVICE_H_ */
